package com.orange.notificationsummary.utils;

import java.util.List;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;

public class NtfcUtils {
	private static final String	TAG	= "NtfcUtils";

	public static boolean isLockScreenInstalled(Context context) {
		boolean flag = false;
		List<ApplicationInfo> appList = context.getPackageManager()
				.getInstalledApplications(PackageManager.GET_ACTIVITIES);
		if (appList != null && !appList.isEmpty()) {
			int count = appList.size();
			for (int i = 0; i < count; i++) {
				if (Constants.PKG_LOCKSCREEN_SETTING
						.equals(appList.get(i).packageName)) {
					flag = true;
					break;
				}
			}
		}
		return flag;
	}

	public static void startActivity(Context context, Intent intent) {
		if (intent == null) {
			return;
		}
		try {
			context.startActivity(intent);
		} catch (ActivityNotFoundException e) {
			LogHelper.e(TAG, "startActivity. ", e);
		}
	}
}
